
//
//  HomeNeedContentHeaderView.m
//  BusinessMarket
//
//  Created by Michael Li on 2018/10/29.
//  Copyright © 2018年 Michael Li. All rights reserved.
//

#import "HomeNeedContentHeaderView.h"
#import "SDCycleScrollView.h"
#import "SpecialRecommendationModel.h"
@interface HomeNeedContentHeaderView()<SDCycleScrollViewDelegate>
@property(nonatomic,strong) SDCycleScrollView *cycleScrollView;
@end
@implementation HomeNeedContentHeaderView
-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, kUIScreen.size.width, kUIScreen.size.width/750*350) delegate:self placeholderImage:[ImageColorHelper createImageWithColor:[UIColor colorWithRed:174/255.0 green:204/255.0 blue:249/255.0 alpha:1]]];
        self.cycleScrollView = cycleScrollView;
        cycleScrollView.delegate = self;
        cycleScrollView.backgroundColor = kBg;
        cycleScrollView.autoScroll = YES;
        cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
        [self addSubview:cycleScrollView];
        cycleScrollView.scrollDirection = UICollectionViewScrollDirectionHorizontal;
        cycleScrollView.showPageControl = YES;
//        cycleScrollView.imageURLStringsGroup = @[@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1540549417030&di=58f880eb12eb626fccc96b33d6a64a27&imgtype=0&src=http%3A%2F%2Fpic1.win4000.com%2Fwallpaper%2F0%2F5789d87be269b.jpg"];
        //        cycleScrollView.currentPageDotColor = [UIColor blackColor];
        //        cycleScrollView.pageControlDotSize = CGSizeMake(14, 3);
        //        cycleScrollView.currentPageDotImage = [ImageColorHelper createImageWithColor:[UIColor colorWithRed:47/255.0 green:119/255.0 blue:246/255.0 alpha:1]];
        //        cycleScrollView.pageDotImage = [ImageColorHelper createImageWithColor:[UIColor colorWithRed:166/255.0 green:199/255.0 blue:250/255.0 alpha:1]];
    }
    return self;
}
- (void)setSpecialModel:(SpecialRecommendationModel *)specialModel
{
    _specialModel = specialModel;
    NSInteger empty = [EmptyModel stringIsNullOrEmpty:specialModel];
    if (empty !=1) {
        self.cycleScrollView.imageURLStringsGroup = [NSArray arrayWithObject:specialModel.icon];
    }
}

@end
